import
request
from './utils/request'
import Vue from 'vue'
import './app.scss'
import store from './store'
import {
  mapState,
  mapActions
} from "vuex";

const App = new Vue({
  onLaunch() {
    console.log('登录32！')
    // request('get', '/api/weixin/get_user_info.htm').then((res) => {
    //   console.log(res, 'get_user_info')
    // })



    wx.login({
      success(res) {
        console.log(res, 'res')
        if (res) {
          //发起网络请求
          store.dispatch('user/getUserInfo', {
            code: res.code
          })

        } else {
          console.log('登录失败！' + res.errMsg)
        }
      },
      fail(e) {
        console.log(e, '232')
      }
    })
  },

  store,
  render(h) {
    // this.$slots.default 是将要会渲染的页面
    return h('block', this.$slots.default)
  }
})

export default App
